# -*- coding: utf-8 -*-

import logging

from sqlalchemy import create_engine

from bopress import settings
from bopress.hook import add_action

plugin_name = "BoPress Core"
version = "1.0"
__author__ = 'yezang'


def db_engine():
    return create_engine("sqlite:///bopress.sqlite3", echo=settings.DEBUG, encoding="utf-8")
    # return create_engine("mysql+pymysql://root:@127.0.0.1:3306/bopress?charset=utf8",
    #           echo=settings.DEBUG, encoding="utf-8", pool_size=20, max_overflow=5, pool_recycle=3600)


def bo_settings(settings):
    settings.DEBUG = True
    settings.LOGGER_LEVEL = logging.ERROR
    settings.DBEngine = db_engine


add_action("bo_settings", bo_settings)
